#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
Created on 2014年9月5日

@author: monstar-216
'''

from datetime import datetime, date,time,timedelta
def get_user_walking_distance(login_count,last_login_date, reset_date, login_date):
    if login_count <= 7:
        correction_A = 5 * login_count
    else:
        correction_A = 35
    
    print "login_date:", login_date
    print "reset_date:", reset_date
    print "longin_date-reset_date:", reset_date - login_date
    login_to_reset = (reset_date - login_date).days

    print "LoginToReset:", login_to_reset
    
    if login_count <= 7:
        correction_B = 0
    elif login_count > 7 and login_to_reset >= 0:
        correction_B = login_count - 7
    else:
        correction_B = abs(login_to_reset)

    print 'correction_A , correction_B,',correction_A , correction_B
    return correction_A + correction_B

def get_reset_date():
    today = date.today()
    reset_day = 1
    year = today.year
    month = today.month

    reset_date = date(year,month,reset_day)
    return reset_date

if __name__ == '__main__':
    login_count = 100
    reset_date = get_reset_date()
    last_login_date = None
    login_date = date(2014,10,17)
    point = get_user_walking_distance(login_count,last_login_date, reset_date, login_date)
    print 'today walk:',point
    
    
    